﻿// Write a program that reads two arrays from the console and compares them element by element.

using System;

class CompareTwoArrays
{
    static void Main()
    {
        Console.Write("Enter first Array lenght: ");
        int firstArrayLenght = int.Parse(Console.ReadLine());
        string[] firstArray = new string[firstArrayLenght];

        // set first array values
        for (int i = 0; i < firstArray.Length; i++)
        {
            Console.Write("Enter element {0} from first Array: ", i + 1);
            firstArray[i] = Console.ReadLine();
        }

        Console.Write("Enter first Array lenght: ");
        int secondArrayLenght = int.Parse(Console.ReadLine());

        bool areEqual = true;
        if (firstArrayLenght != secondArrayLenght)
        {
            areEqual = false;
        }
        else
        {
            string[] secondArray = new string[secondArrayLenght];

            // set second array values
            for (int i = 0; i < secondArray.Length; i++)
            {
                Console.Write("Enter element {0} from first Array: ", i + 1);
                secondArray[i] = Console.ReadLine();
            }

            // check arrays elements
            for (int i = 0; i < secondArray.Length; i++)
            {
                if (!firstArray[i].Equals(secondArray[i]))
                {
                    areEqual = false;
                    break;
                }
            }
        }

        if (areEqual)
        {
            Console.WriteLine("The Arrays are equal");
        }
        else
        {
            Console.WriteLine("The Arrays are NOT equal");
        }
    }
}
